package com.example.administrator.szb.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;

import com.example.administrator.szb.bean.BusinessBean;
import com.example.administrator.szb.fragments.fragment_forWD.FragmentWDType;

import java.util.ArrayList;


/**
 * Created by D N on 2017/9/20.
 */

public class ViewPageAdapter extends FragmentStatePagerAdapter {
    private ArrayList<BusinessBean.DataBean> list;

    public ViewPageAdapter(FragmentManager fm, ArrayList<BusinessBean.DataBean> list) {
        super(fm);
        this.list = list;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {

    }


    @Override
    public Fragment getItem(int position) {
        return FragmentWDType.newInstance(list.get(position).getId());
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return list.get(position).getTitle();
    }
}
